<!doctype html>
<html class="no-js" manifest="__PUBLIC__/home/manifest/test.manifest">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
  <title>家校交流——{$obj.title}</title>
  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">
  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>
  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="绵阳中学英才学校"/>
  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileColor" content="#0e90d2">
  <link rel="stylesheet" href="__PUBLIC__/home/css/amazeui.min.css">
  <link rel="stylesheet" href="__PUBLIC__/home/css/enrolling.css">
  <link rel="stylesheet" href="__PUBLIC__/home/css/submission.css">
  <link rel="stylesheet" href="__PUBLIC__/home/css/Campus_News.css">
  <link rel="stylesheet" href="__PUBLIC__/home/css/pinglun.css">
</head>
<body>

      <!-- 头部 -->
      <header data-am-widget="header" class="am-header am-header-default am-no-layout">
        <div class="am-header-left am-header-nav">
          <a href="javascript:history.go(-1);" class="am-header-left1">
            <img src="__PUBLIC__/home/images/back.png" alt="">
          </a>
        </div>

        <h3 class="am-header-title">
            <a href="#title-link" class="">
              家校交流
            </a>
        </h3>

        <div class="am-header-right am-header-nav">
        <if condition="$_SESSION['login'] eq 1" >
          <a href="{:U('User/user_center')}" class="am-header-right1 denglu">
            <span>个人中心</span>
          </a>
        <else/>
        	<a href="{:U('Login/login')}" class="am-header-right1 denglu">
            <span>登录</span>
          </a>
         </if>
        </div>
      </header>

      <!-- 中间 -->
      <div class="content am-g">
        <div class="content1">
        	<input type="hidden" value="{$obj.id}" id="a_id">
        	<input type="hidden" value="{$_SESSION['username']}" id="username">
          <!-- 新闻内容 -->
          <div class="am-u-sm-12 content1_News">
            <h1>{$obj.title}</h1>
            <div>
              <span>日期:{$obj['time']|date='Y-m-d H:i:s',###}</span>
              <span>作者:{$obj.editor}</span>
              <span>浏览次数:{$obj.visits}</span>
            </div>
            <div>{$obj.content}</div>
          </div>
          <!-- 发布 -->
          <div class="am-u-sm-12">
            <div class="dianzan">
              <a href="javascript:;" id="upvote">点赞&nbsp;&nbsp;&nbsp;<span class="ds-icon-heart">{$obj.upvote}</span>人喜欢</a>
            </div>
            <div class="textareawrap" id="textareawrap">
              <textarea id="uyanmessage" class="textareastyle inputdefaultcolor" placeholder="说点什么吧…"></textarea>
            </div>
            <div class="" style="box-shadow: 0 1px 0 rgba(255,255,255,0.6);position: relative;width: 100%;">
              <button class="ds-post-button" id="btn">发布</button>
            </div>
          </div>
          <!-- 评论框 -->
          <div class="am-u-sm-12 pinglun_title">
            <div class="dianzan">
              <span class="ds-icon-heart">评论列表</span></a>
            </div>
          </div>
          <div class="am-u-sm-12 pinglun_content">
            <volist name="list" id="v">
              <div class="pinglun">
                <div class="pinglun_header">
                  <span class="ds-user-name" data-qqt-account="">{$v.username}</span>
                </div>
                <p>{$v.content}</p>
                <div class="pinglun_footer">
                  <span >{$v['time']|date='Y-m-d H:i:s',###}</span>
                </div>
              </div>
             </volist>
          </div>
          <!-- 分享 -->
          <a href="javascript:;" class="fenxiang">
            <img src="__PUBLIC__/home/images/fenxiang.png" alt="">
          </a>
        </div>
      </div>

       <!-- 分享栏目 -->
      <div class="dianhuahaoma">
        <center>
          <img src="__PUBLIC__/home/images/fenxiang_list.png" alt="">
        </center>
      </div>

      <!-- 底部 -->
     <include file="Public:footer" />

<script src="__PUBLIC__/home/js/jquery.min.js"></script>
<script src="__PUBLIC__/home/js/amazeui.min.js"></script>
<script src="__PUBLIC__/home/js/limit.js"></script>
<script src="__PUBLIC__/home/js/Campus_News.js"></script>
<script src="__PUBLIC__/home/js/footer.js"></script>
<script>
	$(function(){
		$('#upvote').click(function(){
			var upvote =parseInt($('#upvote span').text())+1;
			var a_id = $('#a_id').val();
			$.ajax({
				type:"POST",
				url:"{:U('User/user_upvote')}",
				data:{'upvote':upvote,'id':a_id},
				success:function(data){
					if(data==1){
						$('#upvote span').text(upvote);
					}else{
						alert('失败');
					}
				}
			});
		});
		$("#btn").click(function(){
			var con = $('#uyanmessage').val();
			var a_id = $('#a_id').val();
			var username = $('#username').val();
			if(!username){
				alert('请先登录');
				window.location.href = "{:U('Login/login')}";
				return;
			}
			//获取当前时间方法
			var currentTime=function(){
				var d=new Date();
				var str="";
				str+=d.getFullYear()+"-";
				str+=d.getMonth()+1+"-";
				str+=d.getDate()+"&nbsp;&nbsp;";
				str+=d.getHours()+":";
				str+=d.getMinutes()+":";
				str+=d.getSeconds();
				return str;
			}
			var time=currentTime();
			if(con){
				$.ajax({
					type:"POST",
					url:"{:U('User/user_comment')}",
					data:{'a_id':a_id,'content':con,'username':username},
					success:function(data){
						if(data==1){
							html='<div class="pinglun">'+
				              		'<div class="pinglun_header">'+
				              		'<span class="ds-user-name" data-qqt-account="">'+username+'</span>'+
				              		'</div>'+
				              		'<p>'+con+'</p>'+
			              			'<div class="pinglun_footer">'+
			              			'<span >'+time+'</span>'+
			              			'</div>'+
			              			'</div>';
			              			$('.pinglun_content').prepend(html);
			              			$('#uyanmessage').val('');
						}else{
							alert('失败');
						}
					}
				});
			}else{
				alert('请输入内容');
			}
		});
	});
</script>
</body>
</html>